package com.spring.use.jms.consumer;

import com.spring.use.pojo.RocketMqMessage;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

// topic需要和生产者的topic一致，consumerGroup属性是必须指定的，内容可以随意
@RocketMQMessageListener(nameServer = "${rocketmq.name-server}",topic = "${rocketmq.topic}",consumerGroup = "${rocketmq.consumer1.group}")
@Component
@Slf4j
public class MessageConsumer1 implements RocketMQListener<RocketMqMessage> {

    @Override
    public void onMessage(RocketMqMessage message) {
        log.info("======消费者1===收到了消息,消息内容为:{}",message.getContent());
    }
}
